package com.hjb.service.impl.task;

import com.hjb.service.domain.recharge.SiteUserRecharge;
import com.hjb.service.domain.recharge.SiteUserRechargeExample1;
import com.hjb.service.gateway.baofoo.domain.request.TransReqBF0040002;
import com.hjb.service.mapper.SiteUserRechargeMapper;
import com.hjb.service.recharge.FYRechargeService;
import com.hjb.service.recharge.RechargeService;
import com.hjb.service.task.RechargeQueryService;
import com.hjb.service.task.WithDrawQueryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by gy on 2017/7/29.
 * 充值查询
 */
@Service
public class RechargeQueryServiceImpl implements RechargeQueryService {

	private Logger log = LoggerFactory.getLogger(getClass());
	@Autowired
	private SiteUserRechargeMapper siteUserRechargeMapper;
	@Autowired
	private FYRechargeService fyRechargeService;

	@Override
	public void rechargeQuery() {
		try {
			//1.获取充值记录
			SiteUserRechargeExample1 example = new SiteUserRechargeExample1();
			example.createCriteria().andStatusEqualTo(1);
			List<SiteUserRecharge> siteUserRechargeList = siteUserRechargeMapper.selectByExample(example);
			if (siteUserRechargeList == null || siteUserRechargeList.size() ==0){
				log.info("未查到处理中的充值记录");
				return;
			}
			for (SiteUserRecharge siteUserRecharge:siteUserRechargeList){
				fyRechargeService.rechargeQuery(siteUserRecharge);
			}
		}catch (Exception e){
			log.info("充值查询失败"+e);
		}
	}
}
